import requests

from config import BASE_URL

# 登录
url = "http://ihrm-test.itheima.net/api/sys/login"
headers = {"Content-Type":"application/json"}
body = {"mobile": "13800000002", "password": "123456"}
res = requests.post(url, headers=headers, json=body)
print("登录成功", res.json())
token = "Bearer " + res.json()['data']


# 新增员工
login_url = BASE_URL +"/api/sys/user"
print(login_url)
headersss = {
    "Content-Type":"application/json",
    "Authorization": token
}
bodyadd = {
    "username": "aaa",
    "mobile": "11175105811",
    "workNumber": "100247"
}
res = requests.post(login_url,headers=headersss, json=bodyadd)
print('新增员工',res.json())
